<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<HEAD>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="author" content="zhupeng">
	<TITLE>撤销白卡库存单据</TITLE>
	
	<script language="javascript" src="../script/common.js" type="text/javascript"></script>
	<script language="javascript" type="text/javascript">
		//页面加载方法
		var billType;
		function load(){ 
			Eui.showNavigation();
			setPages(["listview","detview","printview"]);	
		}
		//进入明细页面
		function create(){
		 	if(!checkForm("repeal"))return;
			var serial = $("repeal").serial.value
			CardStore.showBlankBill('detview',serial,function(result){
				billId = result.id;
				var billTypes = Common.getItems("cardbill_type");
				for(var i=0;i<billTypes.length;i++){
					if(result.billType == billTypes[i].text){
						billType = billTypes[i].code;
					}
				}
				if (!result.cancelOper){
					return "<button type=button  onclick=repeals()>撤  销</button> "
				}else{
					var status;
					var statusList = Common.getItems("commonbill_status");
					for(var i=0;i<statusList.length;i++){
						if(result.status == statusList[i].text){
							status = statusList[i].code;
						}
					}
					if(status == BlankCardBillStatus.COMMON_CANCEL){
						return "";
					}
					else return "<button type='button'  onclick='printlnBlankBill()'>打印单据</button>";
				}
			});	
		  	
		}

		//取消方法
	    function resetFunc(){
			$("repeal").reset();
		    switchPage('listview');
		}
		//撤销方法
		function repeals(){
			var serial = $("repeal").serial.value
			if(showQuestion("您确认要撤销这张单据吗?")==true){
				if (id){
			 		DWR.call('blankCardStoreService.cancelBill',serial,function(v){
				    	if(v){
					  		showInformation("撤销成功!");
							CardStore.showBlankBill('detview',serial)
					  	}
		          	},{disCtrl:$('repBut')});
			  	}
			}
		}
		function printlnBlankBill(){
			requestframe.document.location.href = "print_blank_bill.html";
			switchPage("printview");
			//var v = openDialogFrame("/store/print_blank_bill.html?billType="+billType+"&billId="+billId,"打印单据",450,700);
		}
		function closePrintDialog(){
			switchPage("detview");
		}
	</script>
</HEAD>
<body onload="load()">
	<!--页面导航-->
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<div id="listview" >	
		<!--查询条件form-->
		<div class="form">
		<div class="formTitle">撤销白卡库存单据</div>
			<form id="repeal" name="repeal">
				<table cellSpacing=0 cellPadding=4 width="100%" border=0>
					<tr>
						<td><label>单据编号</label> <input type="text" name="serial" onblur="checkV(this,'number',true)" maxlength="12" ><span class="des">*</span></td> 
						<td><button type="button" id="selBtu" name="selBut" onclick="create()">查 询</button></td> 
					</tr>	
				</table>
			</form>
		</div>
	 </div>	
	<!--明细(新增)静态页面部分-->			
	<div id="detview" style="display:none;" align="center"></div>
	<div class="printview" id="printview" style='display:none;'>
		<iframe id="requestframe" name="requestframe" style="width:100%;height:90%;overflow:auto;" frameborder=0 src=""></iframe>
	</div>
</body>
</HTML>
